<template>
    <div class="auth-bg">
        <div class="auth-container">
            <div class="auth-panel">
                <el-button class="switch-btn" @click="toggle" :type="isRegister ? 'primary' : 'success'">
                    {{ isRegister ? '登 录' : '注 册' }}
                </el-button>
            </div>
            <div class="auth-form-wrap">
                <transition name="fade-slide" mode="out-in">
                    <auth-form :key="isRegister" :is-register="isRegister" @switch="toggle" />
                </transition>
            </div>
        </div>
    </div>
</template>

<script setup>
import { ref } from 'vue'
import AuthForm from '../components/AuthForm.vue'

const isRegister = ref(false)
const toggle = () => {
    isRegister.value = !isRegister.value
}
</script>

<style scoped>
.auth-bg {
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    min-width: 100vw;
    overflow: hidden;
    background: linear-gradient(135deg, #e3f0ff 0%, #f8fbff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    display: flex;
    width: 1000px;
    height: 520px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 28px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.10);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

.auth-panel {
    width: 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    background: linear-gradient(120deg, #e0eaff 60%, #f8fbff 100%);
}

.switch-btn {
    width: 240px;
    height: 64px;
    font-size: 26px;
    border-radius: 32px;
    background: linear-gradient(90deg, #7ec8e3 0%, #b6e0fe 100%);
    color: #fff;
    border: none;
    letter-spacing: 10px;
    box-shadow: 0 2px 8px rgba(126, 200, 227, 0.10);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.switch-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(126, 200, 227, 0.18);
}

.auth-form-wrap {
    width: 60%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 0 28px 28px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.04);
    min-height: 100%;
    position: relative;
    overflow: hidden;
}

/* 动画 */
.fade-slide-enter-active,
.fade-slide-leave-active {
    transition: all 0.4s cubic-bezier(.55, 0, .1, 1);
    display: flex;
}

.fade-slide-enter-from {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
}

.fade-slide-leave-to {
    opacity: 0;
    transform: translateY(-30px) scale(0.98);
}
</style>